package org.benjamin.lending.hander;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

/**
 * Created by xywen on 2017/6/5.
 */
@Component("myHandler")
public class MyHandler extends TextWebSocketHandler {

    private final Logger logger = LogManager.getLogger();

    @Override
    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
        TextMessage textMessage = new TextMessage("<p><span class=\"label label-default\">系统自动回复：</span>你好</p>");
        session.sendMessage(textMessage);
        super.handleTextMessage(session, message);
    }
}
